__author__ = 'Antonio'

from PyQt4.QtCore import *
from PyQt4.QtGui import *

import IGuBocadillo

class bocateria(QMainWindow):
    def __init__(self):
        QMainWindow.__init__(self)
        self.ventana = IGuBocadillo.Ui_ventaBocadillos()
        self.ventana.setupUi(self)
        self.connect(self.ventana.CALCULAR,SIGNAL("clicked()"),self.fCalcular)
        self.connect(self.ventana.BORRAR,SIGNAL("clicked()"),self.fBorrar )
        self.connect(self.ventana.CALCULARTOTALDIA,SIGNAL("clicked()"),self.fCalcularTotal)
    def fCalcular(self):
        self.ventana.lcdNumber.display(
            self.ventana.producto1.value()*1.5 +
            self.ventana.producto2.value()*1 +
            self.ventana.producto3.value()*1.2
        )
    def fBorrar(self):
        self.ventana.lcdNumber.display("0")
    def fCalcularTotal(self):
        self.ventana.lcdNumber.display("all")

fichero=open("ticket.txt","a")
fichero.write("EL TOTAL ES: "+str(total)+" EUROS\n")
fichero.write("  El I.V.A es: "+str(total*0.1)+" EUROS\n\n")
fichero.close()



if __name__ == "__main__":
    import sys
    app = QApplication(sys.argv)
    #interfaz = Programa()
    #interfaz.show()
    #sys.exit(app.exec_())

    interfaz = bocateria()
    interfaz.show()
    sys.exit(app.exec_())

